package assql
{
	import flash.events.IEventDispatcher;
	
	/**
	 * A connection to an SQL Database
	 **/
	public interface Connection extends IEventDispatcher
	{
		/**
		 * Gets the auto commit mode of this connection
		 **/
		function get autoCommit():Boolean;
		
		/**
		 * Sets the auto commit mode of the current transaction
		 **/
		function set autoCommit(value:Boolean):void;
		
		/**
		 * Gets the name of the current catalog
		 **/
		function get catalog():String;
		
		/**
		 * Sets the name of the current catalog
		 **/
		function set catalog(value:String):void;
		
		/**
		 * Commits the current transaction
		 **/
		function commit():void;
		
		/**
		 * Connect to the database
		 **/
		function connect():void;
		
		/**
		 * Returns true if the current Connection is connected.
		 **/
		function get connected():Boolean;
		
		/**
		 * Creates a new Statement
		 **/
		function createStatement():Statement;
		
		/**
		 * Disconnect from the database
		 **/
		function disconnect(force:Boolean=false):void;
		
		/**
		 * Gets the metadata for the current connection
		 **/
		function getDatabaseMetadata():DatabaseMetaData;
		
		/**
		 * Removes the given savepoint from the current transaction
		 **/
		function releaseSavepoint(savepoint:Savepoint):void;
		
		/**
		 * Undoes all the changes in the current transaction
		 * 
		 * @param savepoint The savepoint to roll back to.
		 **/
		function rollback(savepoint:Savepoint):void;
		
		/**
		 * Creates a savepoint in the current transaction
		 **/
		function setSavepoint(name:String=""):Savepoint;
		
		/**
		 * Gets the transaction isolation level of the current connection
		 * 
		 * @see assql.SQLConstants SQLConstants
		 **/
		function get transactionIsolation():int;	
		
		/**
		 * Sets the transaction isolation level of the current connection
		 **/
		function set transactionIsolation(value:int):void;	
		
		function setCharSet(value:String):void;
		function getCharSet():String;
	}
}